package action;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

@SuppressWarnings("serial")
public class LoginAction extends ActionSupport {
	
	private String username;
	private String password;
	public String getUsername() {
		return username;
	}
	public void setUsername(String username) {
		this.username = username;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	
	//定义用户请求的execute方法
	public String execute() throws Exception{
		System.out.println("----------"+getUsername());
		System.out.println("----------"+getPassword());
		
		if(getUsername().equals("gyx")&&getPassword().equals("123")){
			ActionContext.getContext().getSession().put("user",getUsername());
			
			return SUCCESS;
		}
		return ERROR;
	}

}
